<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateCruiseTaskOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cruise_task_order_mappings', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('taskId')->default(0)->comment('cruise_check_tasks.id');
            $table->unsignedInteger('orderId')->default(0)->comment('cruise_order.id');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '稽核 - 专项巡检任务->巡检订单 关联表';

            $table->index(['taskId', 'orderId'], 'idx_mapping');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cruise_task_order_mappings');
    }
}
